package com.hfkz.project.utils;

import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

public class ConfigHelper {
	private static ConfigHelper config = null;

	private static final Logger logger = Logger.getLogger(ConfigHelper.class);
	
	private String driver = "";
	private String dbName = "";
	public synchronized static ConfigHelper getConfig() {
		if (config == null) {
			config = new ConfigHelper();
		}
		return config;
	}

	private ConfigHelper() {

		Properties prop = new Properties();
		try {
			InputStream in = getClass().getClassLoader().getResourceAsStream("config.ini");
			prop.load(in);
			this.driver = prop.getProperty("driver", "");
			this.dbName = prop.getProperty("dbName", "");
		} catch (Exception e) {
			logger.error("config.ini error#" + e.toString());
		}
	}

	public String getDriver() {
		return driver;
	}

	public String getDbName() {
		return dbName;
	}
}
